import { ApiProperty } from '@nestjs/swagger';
import { IsString, IsOptional, MaxLength } from 'class-validator';

// 创建分类DTO
export class CreateCategoryDto {
  @ApiProperty({
    description: '分类名称',
    example: '古典',
    maxLength: 50,
  })
  @IsString()
  @MaxLength(50)
  name: string;

  @ApiProperty({
    description: '分类描述',
    example: '古典音乐分类',
    required: false,
    maxLength: 255,
  })
  @IsOptional()
  @IsString()
  @MaxLength(255)
  description?: string;
}

// 更新分类DTO
export class UpdateCategoryDto {
  @ApiProperty({
    description: '分类名称',
    example: '古典',
    required: false,
    maxLength: 50,
  })
  @IsOptional()
  @IsString()
  @MaxLength(50)
  name?: string;

  @ApiProperty({
    description: '分类描述',
    example: '古典音乐分类',
    required: false,
    maxLength: 255,
  })
  @IsOptional()
  @IsString()
  @MaxLength(255)
  description?: string;
}

// 分类响应DTO
export class CategoryResponseDto {
  @ApiProperty({
    description: '分类ID',
    example: 1,
  })
  id: number;

  @ApiProperty({
    description: '分类名称',
    example: '古典',
  })
  name: string;

  @ApiProperty({
    description: '分类描述',
    example: '古典音乐分类',
  })
  description?: string;

  @ApiProperty({
    description: '创建时间',
    example: '2023-01-01T00:00:00Z',
  })
  createdAt: Date;

  @ApiProperty({
    description: '更新时间',
    example: '2023-01-01T00:00:00Z',
  })
  updatedAt: Date;
}
